﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data;

namespace Hesehus
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btnSøg(object sender, RoutedEventArgs e)
        {
            SqlConnection conn = new SqlConnection(@"Data Source=ealdb1.eal.local;User ID=ejl01_usr;Password=Baz1nga1");
            DataTable dt = new DataTable();
            SqlDataAdapter SDA = new SqlDataAdapter("SELECT * FROM Product where Id = "+int.Parse(txtSøg.Text), conn);
            SDA.Fill(dt);
            dataGrid1.DataContext = dt;
            //image1.DataContext = dt;           
                  

        }

        private void image1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //public Nullable<bool> ShowDialog (ProductDetail.xaml)
            // Instantiate window
            Window1 ProductDetail = new Window1();
            ProductDetail.ShowDialog();
            // Show window modally
            // NOTE: Returns only when window is closed
            //Nullable<bool> dialogResult = dialogBox.ShowDialog();
        }
    }
}
